import { createStore } from 'vuex';
import DataStore from '@/global/storage/index';

export default createStore({
    state: {
        collapse: false,
        token: DataStore.getToken() || '',
        userInfo: DataStore.session.get('userinfo') || ''
    },
    mutations: {
        updateCollapseStatus(state, status) {
            if (status == null) {
                state.collapse = !state.collapse;
            } else {
                state.collapse = status;
            }
        },
        updateToken(state, token) {
            state.token = token ? token : '';
        },
        updateUserInfo(state, data) {
            state.userInfo = data ? data : '';
        }
    },
    actions: {

    },
    modules: {}
});
